//
//  MYAgreementVC.m
//  MuYing
//
//  Created by tbb on 2020/3/13.
//  Copyright © 2020 TBB. All rights reserved.
//

#import "MYAgreementVC.h"
#import <WebKit/WebKit.h>

@interface MYAgreementVC ()<WKUIDelegate,WKNavigationDelegate>
@property (nonatomic, strong) WKWebView * wkWebView;
@end

@implementation MYAgreementVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = kYQLS(@"用户协议");
    [self.view addSubview:self.wkWebView];
    
    NSString *path = [[NSBundle mainBundle] pathForResource:@"Best Box Terms of use and privacy policy statement.pdf" ofType:nil];
    NSURL *url = [NSURL fileURLWithPath:path];
    
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [self.wkWebView loadRequest:request];
}

#pragma mark --<WKUIDelegate,WKNavigationDelegate>
- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(null_unspecified WKNavigation *)navigation {
    
}

- (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation {
    
}

- (void)webView:(WKWebView *)webView didFailNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error {
    
}
#pragma mark --<WKUIDelegate,WKNavigationDelegate> end

-(WKWebView *)wkWebView {
    if (!_wkWebView) {
        //创建网页配置对象
        WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
        //初始化
        _wkWebView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-Height_NavBar) configuration:config];
        // UI代理
        _wkWebView.UIDelegate = self;
        // 导航代理
        _wkWebView.navigationDelegate = self;
        // 是否允许手势左滑返回上一级, 类似导航控制的左滑返回
        _wkWebView.allowsBackForwardNavigationGestures = YES;
    }
    return _wkWebView;
}

@end
